/*
 * @Description: 取消订单btn
 * @Author: buwei.huang
 * @Date: 2019-08-20 15:24:04
 * @Last Modified by: buwei.huang
 * @Last Modified time: 2019-08-27 17:26:00
 */

<script>
import baseBtn from './baseBtn'
import { closeOrder } from './api'
export default {
  extends: baseBtn,
  props: {
    isDetail: {
      type: Boolean,
      default: null
    },
    orderNo: {
      type: String,
      default: null
    },
    tag: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
      btnText: '取消订单',
      btnClassName: this.isDetail ? 'com_btn_cancle_isDetail baseBorder baseColorNoAcitve' : 'com_btn_cancle baseBorder baseColorNoAcitve'
    }
  },
  methods: {
    btnEvent() {
      console.log('canclebtn', this.orderNo)
      this.$UI.then(UI => {
        UI.showDialog(
          '提示',
          '确定关闭订单？',
          '确定',
          '再想想',
          msg => {
            if (msg == 0) { //eslint-disable-line
              closeOrder(this.orderNo).then(res => {
                this.isRefresh()
              }).catch(err => {
                console.log(err)
              })
            }
          },
          function (msg) { }
        )
      })
    }
  }
}
</script>
<style>
.com_btn_cancle {
  width: 140px;
  height: 48px;
  background-color: #fff;
}
.com_btn_cancle_isDetail {
  width: 240px;
  height: 64px;
  background-color: #fff;
  border-radius: 32px;
  font-size: 16px; /*no*/
  margin-left: 72px;
}
</style>
